#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

   QMenuBar* bar =new QMenuBar();
   this->setMenuBar(bar);

   QMenu* men1 = new QMenu("父菜单");
   QMenu*men2 =new QMenu("子菜单");

    bar->addMenu(men1);
    men1->addMenu(men2);

    QAction *act1 = new QAction("菜单项1");
    QAction *act2 = new QAction("菜单项2");

    men2->addAction(act1);
    men2->addAction(act2);


    QMenu *act3 = new QMenu("z菜单");
    men2->addMenu(act3);


    QAction *act5= new QAction("zz菜单");
    act3->addAction(act5);

    QMenu *act6 = new QMenu("zzz菜单");

}

MainWindow::~MainWindow()
{
    delete ui;
}

